function User(name) {
    this.name = name;
    this.sayHi = function() {
        alert("My name is: " + this.name);
    };
}


let john = new User('John');

john.sayHi();


// 通过return返回this，指向构造的该对象
function SmallUser() {
    this.name = "John";
    return ;
}

alert(new SmallUser().name);

// 通过return返回一个对象，覆盖this
function BigUser() {
    this.name = "John";
    return {name: "Godzilla"};
}

alert(new BigUser().name);